//
//  CGFileReportDetailViewController.m
//  SchoolClient
//
//  Created by mac on 15/11/20.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "CGFileReportDetailViewController.h"

@interface CGFileReportDetailViewController ()

@end

@implementation CGFileReportDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [Tools getColor:@"ebebeb"];
    self.title = @"报导详情";
    
    [self layoutUI];
    
}

-(void)layoutUI{
    /*
     {
     "id": 1,
     "time": "Nov 10, 2015 3:35:36 PM",
     "title": "测试",
     "content": "sdddddsd"
     }
     */
    //底部View
    UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, SCREEN_HEIGHT - 64 - 20)];
    bottomView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bottomView];
    
    CGRect aFrame = CGRectMake(20, 10, SCREEN_WIDTH - 40, 60);
    UIView *titleView = [[UIView alloc]initWithFrame:aFrame];
    titleView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:titleView];
    //标题Label
    CGRect bFrame = CGRectMake(0, 0, SCREEN_WIDTH - 40, 40);
    UILabel *titleLabel = [[UILabel alloc]initWithFrame:bFrame];
    titleLabel.text = self.currentFile.title;
    titleLabel.textColor = [UIColor blueColor];
    [titleView addSubview:titleLabel];
    //时间Label
    bFrame.origin.y = CGRectGetMaxY(titleLabel.frame);
    bFrame.size.height = 20;
    UILabel *timeLabel = [[UILabel alloc]initWithFrame:bFrame];
    timeLabel.text = [Tools getTimeWithDate:self.currentFile.time];
    timeLabel.textColor = [UIColor grayColor];
    timeLabel.font = [UIFont systemFontOfSize:14];
    [titleView addSubview:timeLabel];
    
    //内容webView
    UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(10, 80, SCREEN_WIDTH - 20, SCREEN_HEIGHT - 64 - 90)];
    webView.backgroundColor = [UIColor clearColor];
    [webView loadHTMLString:self.currentFile.content baseURL:nil];
    [self.view addSubview:webView];
    
    //分割线
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(15, 80, SCREEN_WIDTH - 30, 1)];
    line.backgroundColor = [Tools getColor:@"ebebeb"];
    [self.view addSubview:line];
    

}

@end
